Page({
  data: {
    report: {}
  },
  onLoad(options) {
    let reportData = {};
    try {
      reportData = JSON.parse(decodeURIComponent(options.data));
    } catch (e) {
      reportData = getApp().globalData.lastReport || wx.getStorageSync('lastReport') || { score: 0, total: 40, interp: '默认报告' };
    }
    const percent = (reportData.score / reportData.total) * 100;
    reportData.interp = reportData.interp || `孩子活力${Math.round(percent)}%，改善可增20%！`;
    this.setData({ report: reportData });
  },
  unlockDeep() {
    wx.requestPayment({
      total_fee: 499,
      success: () => wx.showToast({ title: '解锁成功' })
    });
  }
});